$().ready(function() {

    var validator = $('#registerform').validate({
        //debug: true,
        errorElement: "div",
        onKeyup: true,
        submitHandler: function(form) {
            //alert("验证通过验证通过");
            form.submit();
            //return;
        },
        errorPlacement: function(error, element) {
            //error.appendTo(element.next());
            //alert("[发现错误]");

            $("#" + element[0].id).removeClass();
            $("#" + element[0].id + " ~ div").hide();
            $("#" + element[0].id + " ~ .error").show();



        },
        success: function(error, element) {
            //alert("[验证通过]");
            $("#" + element.id).removeClass();
            $("#" + element.id + " ~ div").hide();
            $("#" + element.id + " ~ .success").show();
        },
        rules: {
            filetitle: {
                required: true,
                pattern: /^[a-zA-Z0-9_]{6,16}/
            },
            userimg: {
                required: true
            }

        }
    });

});